package com.example.demo.service;

import com.example.demo.entity.CustomUser;
import com.example.demo.mapper.UserMapper;
import org.apache.catalina.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;

@Service
public class UserService {
    @Autowired
    UserMapper userMapper;

    public List<CustomUser> getUserService(CustomUser customUser){
        return  userMapper.getUser(customUser);
    };

    public List<CustomUser> postuser(CustomUser customUser){
        List<CustomUser> getpeople = userMapper.getpeople(customUser);
        if(getpeople.isEmpty()){
            userMapper.postuser(customUser);
            ArrayList<CustomUser> objects = new ArrayList<>();
            objects.add(customUser);
            return objects;
        }else{
            return   new ArrayList<>();
        }
    };

    public List<CustomUser> OpenIdMa(String openid){
         return userMapper.openidMa(openid);
    };

    public String shancstudent(String id){
        userMapper.scstudent(id);
        return "删除成功";
    };

    public String xgxm(CustomUser customUser){
        userMapper.xgxm(customUser);
        return "修改成功";
    };


}
